<% include "/WEB-INF/includes/cabeceira.gtpl" %>

<div id="content" class="group">
<div id="container">
<div id="container-inner">


<%
def erro = request.getAttribute('erro') 
%>

<% if (erro) { %>
<div class="erro">
${erro?:''}
</div>
<% } %>

<h1>login</h1>

<form id="formulario" method="post" action="/login.groovy">

<fieldset>
<p>introduce os teus datos</p>


<div class="campo">
<label class="etiqueta" for="usuario">Nome</label>
<input type="text" id="usuario" name="usuario"/>
<span class="mensaje"></span>
</div>

<div class="campo">
<label class="etiqueta" for="contrasinal">Contrasinal</label>
 <input type="password" id="contrasinal" name="contrasinal">
<span class="mensaje"></span>
</div>


  <div class="controls">
  
            
            
      <input id="submit" class="submit" name="submit" type="submit" 
          value="Conecta"/>
          
    </div>
    

</fieldset>

</form>
</div>
</div>


</div> <!-- /content -->


<% include "/WEB-INF/includes/pe.gtpl" %>



<script src="js/jquery-1.4.1.js" type="text/javascript"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>


<script type="text/javascript">
jQuery(function() {
	var validator = jQuery("#formulario").validate({
		rules: {
			usuario: "required",
			contrasinal:"required"
			
		},
		messages: {
			usuario: "Tes que inserir o teu usuario",
			contrasinal: "Tes que inserir o teu contrasinal"
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			if ( element.is(":radio") )
				error.appendTo( element.parent().next().next() );
			else if ( element.is(":checkbox") )
				error.appendTo ( element.next() );
			else
				//error.appendTo( element.parent().next() );
				error.appendTo( element.next());
		},
		
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}
	});
	
});	
	
	
</script>	


<% include "/WEB-INF/includes/fin.gtpl" %>

